/**
 * 
 */
package pt.inescid.components.console.commands;

import pt.inescid.components.console.Console;
import pt.inescid.core.GridP2P;


/**
 * @author Sergio Esteves (sesteves at gsd.inesc-id.pt)
 *
 */
public abstract class Command {
	
	protected static final String SYNTAX_SEPARATOR = "\n ";
	
	protected Console console;
	
	protected GridP2P gridP2P;
		
	public Command(Console console) {
		this.console = console;
		this.gridP2P = console.getGridP2P();
	}
	
	// -1 for not defined
	protected void validateArgs(String[] args, int min, int max) throws CommandException {
		if((min != -1 && args.length < min) || (max != -1 && args.length > max)) 				
			throw new CommandException("Invalid number of arguments");
	}
	
	public abstract String getCmdName();
	public abstract void execute(String[] args) throws CommandException;
	public abstract String synopsis();
}
